<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>评估问卷</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../css/page-health-riskQuestion.css"/>
    <link rel="icon" href="../img/asset-favico.ico">

    <link rel="stylesheet" href="../css/page-health-riskQuestion.css"/>
</head>
<body class="hold-transition">
<div class="app">
    <!-- 页面头部 -->
    <div class="top-header">
        <a href="health-risk.html"><span class="f-left"><i class="icon-back"></i>返回</span></a>
        <span class="center">传智健康</span>
        <span class="f-right"><i class="icon-more"></i></span>
    </div>
    <!-- 页面内容 -->
    <div class="contentBox">
        <div class="question">
            <div class="q-tit">
                <p class="tit">请根据实际情况，完成问卷</p>
            </div>
            <div class="q-choose">

                <div id="app">
                    <div class="app-container">
                        <div class="box">
                            <!-- 新增标签弹层 -->
                            <div class="add-form" :visible.sync="dialogFormVisible">
                                <el-form ref="dataAddForm" :model="formData" :rules="rules" label-position="right"
                                         label-width="100px">
                                    <el-row>
                                        <el-col :span="20">
                                            <el-form-item label="姓名" prop="name">
                                                <el-input v-model="formData.name"/>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="20">
                                            <el-form-item label="年龄">
                                                <el-input v-model="formData.age"/>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="20">
                                            <el-form-item label="性别">
                                                <el-select v-model="formData.sex">
                                                    <el-option label="男" value="1"></el-option>
                                                    <el-option label="女" value="0"></el-option>
                                                </el-select>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>


                                    <el-tabs type="card">
                                        <!--<el-tab-pane label="检查项信息" name="1">-->
                                        <el-tab-pane v-for="c in physiqueData" :label="c.name" :name="c.id">
                                            <el-row v-for="q in c.questionList">
                                                {{q.name}}
                                                <br>
                                                <el-select v-model="q.answer" style="float: right">
                                                    <el-option label="没有" value="1"></el-option>
                                                    <el-option label="很少" value="2"></el-option>
                                                    <el-option label="有时" value="3"></el-option>
                                                    <el-option label="经常" value="4"></el-option>
                                                    <el-option label="总是" value="5"></el-option>
                                                </el-select>
                                            </el-row>
                                            <br>
                                        </el-tab-pane>
                                    </el-tabs>
                                    </el-row>
                                </el-form>
                                <div slot="footer" class="dialog-footer">
                                    <el-button type="primary" @click="handleAdd()">确定</el-button>
                                </div>
                            </div>

                            <el-dialog title="查看报告" :visible.sync="dialogFormVisible4Find">
                                <el-row>
                                    <!--                                    <el-col :span="12">-->
                                    <!--                                        档案号：<span>{{reportData.fileid}}</span>-->
                                    <!--                                    </el-col>-->
                                    <el-col :span="12">
                                        姓名：<span>{{reportData.name}}</span>
                                    </el-col>
                                    <el-col :span="12">
                                        年龄：<span>{{reportData.age}}</span>
                                    </el-col>
                                    <el-col :span="12">
                                        性别： <span>{{reportData.sex== '1' ? '男' : '女'}}</span>
                                    </el-col>
                                </el-row>
                                <el-row>

                                    <span>平和体质：{{reportData.pinghe == '1' ? '是' : '否'}}</span>
                                    <br>
                                    <span>气虚体质：{{reportData.qixu == '1' ? '是' : '否'}}</span>
                                    <br>
                                    <span>阳虚体质：{{reportData.yangxu == '1' ? '是' : '否'}}</span>
                                    <br>
                                    <span>阴虚体质：{{reportData.yinxu == '1' ? '是' : '否'}}</span>
                                    <br>
                                    <span>痰湿体质：{{reportData.tanshi == '1' ? '是' : '否'}}</span>
                                    <br>
                                    <span>湿热体质：{{reportData.shire == '1' ? '是' : '否'}}</span>
                                    <br>
                                    <span>血瘀体质：{{reportData.xueyu == '1' ? '是' : '否'}}</span>
                                    <br>
                                    <span>气郁体质：{{reportData.qiyu == '1' ? '是' : '否'}}</span>
                                    <br>
                                    <span>特禀体质：{{reportData.tebing == '1' ? '是' : '否'}}</span>

                                </el-row>
                            </el-dialog>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>


</body>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script>
    var vue = new Vue({
        el: '#app',
        data: {
            activeName: '1',//添加/编辑窗口Tab标签名称
            dialogFormVisible: true,

            dataList: [],//当前页要展示的表单数据
            formData: {},//表单数据
            constitutions: [],//新增和编辑表单中对应的题目列表数据

            reportData: {},//表单数据
            reportList: [],//当前页要展示的体制分数数据

            dialogFormVisible4Find: false,
        },
        //钩子函数，VUE对象初始化完成后自动执行
        created() {
            this.handleCreate();
        },
        methods: {
            //添加
            handleAdd() {
                this.formData.constitutions = this.constitutions;
                this.dialogFormVisible4Find = true;
                axios.post("/physique/submitScore.do", this.formData).then((res) => {
                    if (res.data.flag) {
                        this.$message.success("分析成功");
                        this.reportData = res.data.data;
                    } else {
                        this.$message.error(res.data.message);
                    }

                });
            },
            // 重置表单
            resetForm() {
                this.formData = {};
                this.$refs['dataAddForm'].resetFields();
            },
            // 弹出添加窗口
            handleCreate() {
                axios.post("/physique/findAll.do", this.pagination).then((res) => {
                    if (res.data.flag) {
                        this.constitutions = res.data.data;
                    }
                });
                this.resetForm();
            }
        }
    })
</script>
</html>